//pinia 用户使用方法
import { defineStore } from 'pinia'
export const useUserStore = defineStore( {
    id: 'user',
    state: () => {
        return {
            token:localStorage.getItem('token') || '',
            userInfo: JSON.parse(localStorage.getItem('userInfo') || '{}')
        }
    },
    actions: {
        setUserInfo(data: any){
            this.token = data.token
            this.userInfo = data.user_info
            localStorage.setItem('token',this.token)
            localStorage.setItem('userInfo',JSON.stringify(this.userInfo))
        }
        
    }
})